#!python3
# -*- coding=utf-8 -*-
#本脚由亁颐堂现任明教教主编写，用于乾颐盾Python课程！
#教主QQ:605658506
#亁颐堂官网www.qytang.com
#乾颐盾是由亁颐堂现任明教教主开发的综合性安全课程
#包括传统网络安全（防火墙，IPS...）与Python语言和黑客渗透课程！

import pyautogui as GUI
from time import sleep
#move mouse to FF address blank:
#sleep(2)

username = 'acsadmin'
pwd = 'Cisc0123'
GUI.click(x=223,y=46,button='left')
GUI.hotkey('ctrl','a')
GUI.press('del')
GUI.typewrite('https://202.100.1.241/acsadmin')
GUI.press('enter')
GUI.click(x=124,y=312,button='left')
#locate the username blank:
#username_blank = GUI.locateOnScreen('logon.png')
#username_x, username_y = GUI.center(username_blank)
#GUI.click(username_x,(username_y - 20),button='left')
GUI.typewrite(username)
GUI.press('tab')
GUI.typewrite(pwd)
GUI.press('enter')

sleep(1)
#users and identity Stores
location = GUI.locateOnScreen('users_id.png')
l_x, l_y = GUI.center(location)
GUI.click(l_x, l_y, button='left')

sleep(1)

#user account
#location = GUI.locateOnScreen('internal_user.png')
#l_x, l_y = GUI.center(location)
#GUI.click(l_x, l_y , button='left')

location = GUI.locateOnScreen('users.png')
l_x, l_y = GUI.center(location)
GUI.click(l_x, l_y, button='left')

sleep(1)

#create user
create_location = GUI.locateOnScreen('create.png')
create_x, create_x_y = GUI.center(create_location)
#GUI.click(create_x, create_x_y, button='left')

sleep(1)
users_dict = {'user1':'Cisc0123', 
    		  'user2':'Cisc0123',
			  'user3':'Cisc0123',
			  'user4':'Cisc0123',
			  'user5':'Cisc0123',}
#username
for username,password in users_dict.items():
	sleep(1)
	GUI.click(create_x, create_x_y, button='left')
	sleep(1)
	location = GUI.locateOnScreen('name.png')
	l_x, l_y = GUI.center(location)
	GUI.click(l_x+100, l_y, button='left')
	GUI.typewrite(username)

	#sleep(1)

	#password
	pwd_btn = GUI.locateOnScreen('pwd.png')
	pwd_x,pwd_y = GUI.center(pwd_btn)
	GUI.click(pwd_x+30, pwd_y, button='left')
	GUI.typewrite(password)
	GUI.press('tab')
	GUI.typewrite(password)
	#submit 
	sbm_btn = GUI.locateOnScreen('sbm.png')
	sbm_x,sbm_y = GUI.center(sbm_btn)
	GUI.click(sbm_x, sbm_y, button='left')


GUI.alert("Add users!!!")